<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<title></title>
	
	<script type="text/javascript" src="__STATIC__/uploadify/jquery-1.8.2.min.js"></script>
	<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
	<link href="__STATIC__/uploadify/uploadify.css" type="text/css" rel="stylesheet"></link>
	<script type="text/javascript" charset="utf-8" src="__STATIC__/ueditor1_4_3/ueditor.config.js"></script>
	    <script type="text/javascript" charset="utf-8" src="__STATIC__/ueditor1_4_3/ueditor.all.min.js"> </script>
	    <script type="text/javascript" charset="utf-8" src="__STATIC__/ueditor1_4_3/lang/zh-cn/zh-cn.js"></script>
	<css file="__STATIC__/hdjs/hdjs.css"/>
	<js file="__STATIC__/hdjs/hdjs.min.js"/>
	<js file="__STATIC__/cal/lhgcalendar.min.js"/>
	<style type="text/css">
		.liImg{
			width:80px;
			position: relative;
		}
		.closeBtn{
			width:15px;
			height: 15px;
			line-height: 15px;
			text-align: center;
			background: #FFF;
			cursor: pointer;
			position: absolute;
			top:0px;
			right: 0px;
		}
		.closeBtn:hover{
			background: #ccc;
		}
	</style>
</head>
<body>
	<div class="hd-menu-list">
	    <ul>
	        <li><a href="{|U:'Article/index'}">文章列表</a></li>
	        <li class="active"><a href="{|U:'Article/add'}">添加文章</a></li>
	    </ul>
	</div>

	<form action="" method="post">
		
		<div class="hd-tab">
		    <ul class="hd-tab-menu">
		        <li lab="base" class="active">
		            <a> 基本设置 </a>
		        </li>
		        <li lab="content">
		            <a>内容 </a>
		        </li>
		        <li lab="thumb">
		            <a>缩略图 </a>
		        </li>
		    </ul>
		    <div class="hd-tab-content">
		        <div lab="base" class="hd-tab-area">
		            <table class="hd-form hd-table hd-table-form">
		                <tbody><tr>
		                    <th class="hd-w100">标题</th>
		                    <td>
		                        <input name="title" type="text" value="{$data.title}">
		                    </td>
		                </tr>
		                <tr>
		                    <th>所属栏目</th>
		                    <td>
		                       <select name="cid" id="">
		                       		<foreach from="$category" key="$k" value="$c">
			                       		<option value="{$c.cid}"
			                       		<if value="$c.cid==$data.cid">selected=""</if> >{$c._name}</option>
			                       	</foreach>
		                       </select>	
		                    </td>
		                </tr>
		                <tr>
		                    <th>文章标签</th>
		                    <td>
		                    	<list from="$tags" name="$t">
			                       <input type="checkbox" name="tid[]" value="{$t.tid}" <if value="in_array($t.tid,$data['tids'])">checked=""</if> > {$t.tname} &emsp;
			                   </list>
		                    </td>
		                </tr>
		                <tr>
		                    <th>作者</th>
		                    <td>
		                        <input name="author" type="text">
		                    </td>
		                </tr>
		                <tr>
		                    <th>摘要</th>
		                    <td>
		                        <input name="digest" type="text">
		                    </td>
		                </tr>
		                <tr>
		                    <th>关键字</th>
		                    <td>
		                        <input name="keyword" type="text">
		                    </td>
		                </tr>
		                <tr>
		                    <th>添加时间</th>
		                    <td>
		                        <input readonly="readonly" id="sendtime" name="sendtime" value="{|date:'Y/m/d H:i:s',$data['sendtime']}" class="hd-w150" type="text">
								<script>
								    $(function () {
								        $('#sendtime').calendar({format: 'yyyy/MM/dd HH:mm:ss'});
								    })
								</script>
		                    </td>
		                </tr>
		            </tbody></table>
		        </div>
		        <div lab="content" class="hd-tab-area">
		        	<table class="hd-form hd-table hd-table-form">
			        	<tr>
		                    <th>描述</th>
		                    <td>
		                    	<textarea name="description" id="" class="hd-w300 hd-h100" cols="30" rows="10"></textarea>
		                    </td>
		                </tr>
			            <tr>
		                    <th>内容</th>
		                    <td>
		                    	<script id="editor" name="content" type="text/plain" style="width:600px;height:300px;">{$data.content}</script>
							    <script>
							        var ue = UE.getEditor('editor');
							    </script>
		                    </td>
		                </tr>
	                </table>
		        </div>
		        <div lab="thumb" class="hd-tab-area">
		        	<table class="hd-form hd-table hd-table-form">
			        	<tr>
		                    <th>缩略图</th>
		                    <td>
		                    	<div lab="uploadFile">
						            <input id="file" type="file" multiple="true">
						            <span>类型: *.jpg,*.png 大小: 2000KB 数量: 10</span>
						            <script type="text/javascript">
						                $(function() {
						                    $('#file').uploadify({
						                        'formData'     : {//POST数据
						                            '<?php echo session_name();?>' : '<?php echo session_id();?>',
						                        },
						                        'fileTypeDesc' : '上传文件',//上传描述
						                        'fileTypeExts' : '{$set['filetype']}',
						                        'swf'      : '__STATIC__/uploadify/uploadify.swf',
						                        'uploader' : '{|U:"Flink/upload"}',
						                        'buttonText':'选择文件',
						                        'fileSizeLimit' : '2000KB',
						                        'uploadLimit' : 1000,//上传文件数
						                        'width':65,
						                        'height':25,
						                        'successTimeout':10,//等待服务器响应时间
						                        'removeTimeout' : 0.2,//成功显示时间
						                        'onUploadSuccess' : function(file, data, response) {
						                            data=$.parseJSON(data);
						                            var imageUrl = data.image?data.url:'__STATIC__/image/default.png';
						                            var li="<li class='liImg' path='"+data.path+"' url='"+data.url+"'><img src='"+imageUrl+"' class='hd-w80 hd-h70'/><input type='hidden' name='thumb' value='"+data.path+"'/><div class='closeBtn'>X</div></li>";
						                            $("#uploadList ul").prepend(li);
						                        }
						                    });
						                });

						            </script>
						            <div id="uploadList">
						                <ul>
						 					<if value="!empty($data['thumb'])">
						 						<li class='liImg' path='{$data.thumb}' url='{$data.thumb}'><img src='__ROOT__/{$data["thumb"]}' class='hd-w80 hd-h70'/><input type='hidden' name='thumb' value='{$data.thumb}'/><div class='closeBtn'>X</div></li>
						 					</if>
						                </ul>
						            </div>
						            <script type="text/javascript">
						            	$(function(){
						            		$('.closeBtn').live('click',function(){
						            			oLi = $(this).parents('li').eq(0);
						            			path = oLi.attr('path');
						            			$.ajax({
						            				url:'{|U:"Flink/delPic"}',
						            				data:{path:path},
						            				type:'post',
						            				dataType:'json',
						            				success:function(data){
						            					if(data.status==1){
						            						oLi.remove();
						            					}
						            				}
						            			})
						            		})
						            	})
						            </script>	
						        </div>
		                    </td>
		                </tr>
			            
	                </table>
		        </div>
		    </div>
		</div>

		<input type="submit" value="保存" class="hd-btn"><input type="hidden" name="aid" value="{$hd.get.aid}">
	</form>
</body>
</html>